export default {
	attrs: [{
			name: 'name',
			remark: '表单名',
			type: 'String',
		},
		{
			name: 'model-value / v-model',
			remark: '表单值',
			type: 'String',
		},
		{
			name: 'label',
			remark: '标签。<var>{align,br,text,valign,vertical,width}</var>。属性说明参考<a href="#widgets/Label">Label组件</a>',
			type: 'String / Object',
			option: ``,
			default: '',
		},
		{
			name: 'placeholder',
			remark: '当表单没有值时显示的提示文本',
			type: 'String',
		},
		{
			name: 'readonly',
			remark: '是否只读',
			type: 'Boolean',
			option: '',
			default: '',
		},
		{
			name: 'readonly-validate',
			remark: '本参数设置为true，并且表单同时设置了<var>readonly</var>为true，提交表单时将会验证',
			type: 'Boolean',
			option: '',
			default: '',
		},
		{
			name: 'disabled',
			remark: '是否禁用',
			type: 'Boolean',
		},
		{
			name: 'required',
			remark: '是否必填项。可以是布尔值或<var>{value,text,trigger}</var>',
			type: 'Boolean / Object',
			option: `<div><var>value</var>: Boolean</div>
        <div><var>text</var>: 验证提示内容</div>
        <div><var>trigger</var>: 触发条件，可选值: "blur"</div>`,
		},
		{
			name: 'validate-default',
			remark: '组件默认内置的验证。格式: <var>{trigger}</var>',
			type: 'Object',
			option: '<div><var>trigger</var>: 触发条件，可选值: "blur"</div>',
		},
		{
			name: 'validate-handler',
			remark: '自定义验证函数。验证成功无需返回；验证失败返回说明原因的字符串。格式为函数或<var>{value,trigger}</var>',
			type: 'Function / Object',
			option: `<div><var>value</var>: Function(val)</div>
        <div><var>trigger</var>: 触发条件，可选值: "blur"</div>`,
		},
		{
			name: 'input-width',
			remark: '输入框区域宽度',
			type: 'Number',
		},
		{
			name: 'input-height',
			remark: '输入框区域高度',
			type: 'Number',
		},
	],
	methods: [{
		name: 'focus()',
		remark: '聚焦',
		option: '',
		default: '',
		return: 'this',
		examples: [{
			remark: '如果表单设置了name="myName"',
			code: `
      $.vm(this).f('myName').focus()
      `
		}, {
			remark: '如果表单设置了ref="myName"',
			code: `
      this.$refs.myName.focus()
      `
		}]
	}, {
		name: 'val([modelValue])',
		remark: '设置/获取modelValue',
		option: '<var>modelValue</var>: 可选',
		return: '返回modelValue',
		examples: [{
			remark: '如果表单设置了name="myName"',
			code: `
      let r = $.vm(this).f('myName').val()
      `
		}, {
			remark: '如果表单设置了ref="myName"',
			code: `
      let r = this.$refs.myName.val()
      `
		}]
	}, {
		name: 'formVal()',
		remark: '获取表单值',
		option: '',
		return: '表单值字符串',
		examples: [{
			remark: '如果表单设置了name="myName"',
			code: `
      let r = $.vm(this).f('myName').formVal()
      `
		}, {
			remark: '如果表单设置了ref="myName"',
			code: `
      let r = this.$refs.myName.formVal()
      `
		}]
	}, {
		name: 'isModified()',
		remark: '检测表单是否有修改',
		option: '',
		return: 'true/false',
		examples: [{
			remark: '如果表单设置了name="myName"',
			code: `
      let r = $.vm(this).f('myName').isModified()
      `
		}, {
			remark: '如果表单设置了ref="myName"',
			code: `
      let r = this.$refs.myName.isModified()
      `
		}]
	}, {
		name: 'saveModified()',
		remark: '把当前的表单值设置为默认值',
		option: '',
		return: '',
		examples: [{
			remark: '如果表单设置了name="myName"',
			code: `
      $.vm(this).f('myName').saveModified()
      `
		}, {
			remark: '如果表单设置了ref="myName"',
			code: `
      this.$refs.myName.saveModified()
      `
		}]
	}, {
		name: 'reset()',
		remark: '重置为初始状态',
		option: '',
		default: '',
		examples: [{
			remark: '如果表单设置了name="myName"',
			code: `
		  $.vm(this).f('myName').reset()
		  `
		}, {
			remark: '如果表单设置了ref="myName"',
			code: `
		  this.$refs.myName.reset()
		  `
		}]
	}, {
		name: 'valid()',
		remark: '执行验证',
		option: '',
		return: 'true/false',
		examples: [{
			remark: '如果表单设置了name="myName"',
			code: `
      let r = await $.vm(target).f('myName').valid()
      `
		}, {
			remark: '如果表单设置了ref="myName"',
			code: `
      let r = await this.$refs.myName.valid()
      `
		}]
	}],
	events: [{
		name: 'change',
		remark: '数据有变化时触发',
		option: '(event: Event, value: String)',
	}],
}
